package org.elephantt.webby.example.webapp;

import org.elephantt.webby.*;

import java.io.IOException;

public class SiteController {
  public String home() {
    return "<html><form method='POST' action='/create_person'>name: <input name='urlname'/><input type='submit'/></form></html>";
  }

  public JspView person(Request request) {
    return new JspView("person.jsp", Model.create().append("name", request.getUrlParameter("urlname")));
  }

  public Redirect createPerson(Request request) {
    return new Redirect("/person/" + request.getParameter("urlname"));
  }
}